﻿<%@ Page Title="" Language="C#" MasterPageFile="~/InternalSite.Master" AutoEventWireup="true" CodeBehind="TrendSugesstion.aspx.cs" Inherits="DATN.mds.TrendSuggest.TrendSugesstion" %>


<asp:Content ID="Content1" ContentPlaceHolderID="MainContent1" runat="server">

    <script type="text/javascript">
        //Reference of the GridView. 
        var TargetBaseControl = null;
        //Total no of checkboxes in a particular column inside the GridView.
        var CheckBoxes;
        //Total no of checked checkboxes in a particular column inside the GridView.
        var CheckedCheckBoxes;
        //Array of selected item's Ids.
        var SelectedItems;
        //Hidden field that wil contain string of selected item's Ids separated by '|'.
        var SelectedValues;

        window.onload = function () {
            //Get reference of the GridView. 
            try {
                TargetBaseControl = document.getElementById('<%= this.gvCheckboxes.ClientID %>');
            }
            catch (err) {
                TargetBaseControl = null;
            }

            //Get total no of checkboxes in a particular column inside the GridView.
            try {
                CheckBoxes = parseInt('<%= this.gvCheckboxes.Rows.Count %>');
            }
            catch (err) {
                CheckBoxes = 0;
            }

            //Get total no of checked checkboxes in a particular column inside the GridView.
            CheckedCheckBoxes = 0;

            //Get hidden field that wil contain string of selected item's Ids separated by '|'.
            SelectedValues = document.getElementById('<%= this.hdnFldSelectedValues.ClientID %>');

            //Get an array of selected item's Ids.
            if (SelectedValues.value == '')
                SelectedItems = new Array();
            else
                SelectedItems = SelectedValues.value.split('|');

            //Restore selected CheckBoxes' states.
            if (TargetBaseControl != null)
                RestoreState();
        }

        function HeaderClick(CheckBox) {
            //Get all the control of the type INPUT in the base control.
            var Inputs = TargetBaseControl.getElementsByTagName('input');

            //Checked/Unchecked all the checkBoxes in side the GridView & modify selected items array.
            for (var n = 0; n < Inputs.length; ++n)
                if (Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf('chkBxSelect', 0) >= 0) {
                    Inputs[n].checked = CheckBox.checked;
                    if (CheckBox.checked)
                        SelectedItems.push(document.getElementById(Inputs[n].id.replace('chkBxSelect', 'hdnFldId')).value);
                    else
                        DeleteItem(document.getElementById(Inputs[n].id.replace('chkBxSelect', 'hdnFldId')).value);
                }

            //Update Selected Values. 
            SelectedValues.value = SelectedItems.join('|');

            //Reset Counter
            CheckedCheckBoxes = CheckBox.checked ? CheckBoxes : 0;
        }

        function ChildClick(CheckBox, HCheckBox, Id) {
            //Modifiy Counter;            
            if (CheckBox.checked && CheckedCheckBoxes < CheckBoxes)
                CheckedCheckBoxes++;
            else if (CheckedCheckBoxes > 0)
                CheckedCheckBoxes--;

            //Change state of the header CheckBox.
            if (CheckedCheckBoxes < CheckBoxes)
                HCheckBox.checked = false;
            else if (CheckedCheckBoxes == CheckBoxes)
                HCheckBox.checked = true;

            //Modify selected items array.
            if (CheckBox.checked)
                SelectedItems.push(Id);
            else
                DeleteItem(Id);

            //Update Selected Values. 
            SelectedValues.value = SelectedItems.join('|');
        }

        function RestoreState() {
            //Get all the control of the type INPUT in the base control.
            var Inputs = TargetBaseControl.getElementsByTagName('input');

            //Header CheckBox
            var HCheckBox = null;

            //Restore previous state of the all checkBoxes in side the GridView.
            for (var n = 0; n < Inputs.length; ++n)
                if (Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf('chkBxSelect', 0) >= 0)
                    if (IsItemExists(document.getElementById(Inputs[n].id.replace('chkBxSelect', 'hdnFldId')).value) > -1) {
                        Inputs[n].checked = true;
                        CheckedCheckBoxes++;
                    }
                    else
                        Inputs[n].checked = false;
                else if (Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf('chkBxHeader', 0) >= 0)
                    HCheckBox = Inputs[n];

            //Change state of the header CheckBox.
            if (CheckedCheckBoxes < CheckBoxes)
                HCheckBox.checked = false;
            else if (CheckedCheckBoxes == CheckBoxes)
                HCheckBox.checked = true;
        }

        function DeleteItem(Text) {
            var n = IsItemExists(Text);
            if (n > -1)
                SelectedItems.splice(n, 1);
        }

        function IsItemExists(Text) {
            for (var n = 0; n < SelectedItems.length; ++n)
                if (SelectedItems[n] == Text)
                    return n;

            return -1;
        }     
    </script>


<div id="contentx" class="clearingfix">    
              <br/>
              <center> <h3>G&#7907;i Ý Khách Hàng</h3> </center>
               <hr/>
               <div class="floatboxx">
               <br/>
                <b>Tôi H&#432;&#7899;ng &#273;&#7871;n &#273;&#7889;i t&#432;&#7907;ng...</b>
                <br/>
                Tìm Ki&#7871;m:  
    <asp:TextBox ID="Tbx_Search" runat="server" CssClass="bty" MaxLength="30" Width="300px"></asp:TextBox>
        <br/>

    <asp:Label ID="Lb_Status" runat="server" Text=""></asp:Label>
    <br/>
     Tìm Ki&#7871;m Theo l&#7921;a ch&#7885;n: 
    <br/>
                <center>
                   <table style=" font-size:medium;">
                       <tr>
                           <td>
                             <b>  Có Gi&#7899;i Tính: </b>
                           </td>
                           <td>
                                 <asp:DropDownList ID="ddp_Sex" runat="server" CssClass="ddrpag">
                    </asp:DropDownList>
                           </td>
                           <td>
                              <b> Tình Tr&#7841;ng Hôn Nhân: </b>
                           </td>
                           <td>
                                <asp:DropDownList ID="ddp_MaStatus" runat="server" CssClass="ddrpag">
                                    </asp:DropDownList>
                           </td>
                       </tr>

                       <tr>
                           <td>
                              <b> &#272;&#7897; Tu&#7893;i: </b>
                           </td>
                           <td>
                                 <asp:DropDownList ID="ddp_Dotuoi" runat="server" CssClass="ddrpag">
                    </asp:DropDownList>
                           </td>
                           <td>
                              <b>V&#7899;i M&#7913;c L&#432;&#417;ng: </b>
                           </td>
                           <td>
                              <asp:DropDownList ID="ddp_Salary" runat="server" CssClass="ddrpag">
                    </asp:DropDownList>
                           </td>
                       </tr>

                        <tr>
                           <td>
                               <b> H&#7885; Làm Công Vi&#7879;c: </b> 
                           </td>
                           <td>
                                <asp:DropDownList ID="ddp_Job" runat="server" CssClass="ddrpag">
                    </asp:DropDownList>
                           </td>
                           <td>
                              <%--<b> Thành Ph&#7889;: </b>--%>
                           </td>
                           <td>
                                 <asp:DropDownList ID="ddp_City" runat="server" CssClass="ddrpag" Visible="false">
                    </asp:DropDownList>
                           </td>
                       </tr>
                        <tr>
                           <td>
                               &nbsp;
                           </td>
                           <td>
                           
                           </td>
                           <td>
                               &nbsp;
                           </td>
                       </tr>
                   </table>
                   </center>
                  
    </div>
     <hr/>
    
    </div>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent2" runat="server">

<div id="contentx" class="clearingfix">    
              
               <div class="floatboxx">
               <br/><center>
                     <asp:Button ID="btSearch" runat="server" CssClass="btz" Text="Tìm Ki&#7871;m Với Từ Khóa!" 
                        onclick="btSearch_Click" />
                        <br/>
    <asp:Label ID="Lb_Stt" runat="server" Text="Thông tin"></asp:Label>

 <asp:GridView ID="gvCheckboxes" runat="server"
    AutoGenerateColumns="False" BackColor="White" 
     RowStyle-CssClass = "Grd_Row"
        CellPadding="2"
         OnPageIndexChanging="gvCheckboxes_PageIndexChanging"
            OnRowDataBound="gvCheckboxes_RowDataBound" AllowPaging="True" PageSize="25">
        <Columns> 
                 <asp:TemplateField HeaderText="">
                     <ItemTemplate>
                        <asp:CheckBox ID="chkBxSelect" runat="server" />
                        <asp:HiddenField ID="hdnFldId" runat="server" Value='<%# Eval("Cus_Id") %>' />
                     </ItemTemplate>
                     <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                     <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                     <HeaderTemplate>
                        <asp:CheckBox ID="chkBxHeader" onclick="javascript:HeaderClick(this);" runat="server" />
                     </HeaderTemplate>
                  </asp:TemplateField>
            
            <asp:TemplateField>
                <HeaderTemplate>H&#7885; Và Tên </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Lb_LastName" 
                                runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "LastName") %>'></asp:Label>
                   <asp:Label ID="Lb_FirstName" 
                                runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "FirstName") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="140px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="140px" />
            </asp:TemplateField>
            
            <asp:TemplateField>
                <HeaderTemplate>Gi&#7899;i Tính</HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Lb_Sex" 
                                runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "Sex") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" />
            </asp:TemplateField>

            <asp:TemplateField>
                <HeaderTemplate>Địa Chỉ </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Lb_Address" 
                                runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "Address") %>'></asp:Label>
                   <asp:Label ID="Lb_City" 
                                runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "City") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="140px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="140px" />
            </asp:TemplateField>

            <asp:BoundField DataField="Habit" HeaderText="S&#7903; Thích"
                            NullDisplayText='<img src="../Content/images/error.png" />'> 
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="250px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="250px" />
                            </asp:BoundField>


            <asp:BoundField DataField="Company" HeaderText="Công Ty"
                            NullDisplayText='<img src="../Content/images/error.png" alt="c&#7853;p nh&#7853;t thêm thông tin"/>'>  
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            </asp:BoundField>

                     
                </Columns>
                <FooterStyle BackColor="#004a96" />
                <HeaderStyle BackColor="#004a96" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#004a96" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#b4cbd5" ForeColor="Black" Font-Size= "Small" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />

                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />

    </asp:GridView>



    <asp:HiddenField ID="hdnFldSelectedValues" runat="server" />
                <br/>
                    <asp:Button ID="btnMail" runat="server" OnClick="btnMail_Click" Text="G&#7917;i Th&#432;" CssClass="btx" />
                    <asp:Button ID="BtbGroup" runat="server" Text="Thêm Vào Nhóm"  CssClass="btz" onclick="BtbGroup_Click" />
                   <asp:Button ID="btnDelete" runat="server"  Text="Xóa Khách Hàng" CssClass="bty" 
                           onclick="btnDelete_Click" />

                    <br/>
                    <asp:Label ID="Label8" runat="server" Text="Label"></asp:Label>
         </center>
                <br/>
   </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent3" runat="server">

<br/>  
    <b> - Thông tin th&#7889;ng kê:</b> 
    <br/>
         <asp:Button ID="bt_ttAll" runat="server" CssClass="bty"
                    Text="Thông tin th&#7889;ng kê" onclick="bt_ttAll_Click" />

        <asp:Button ID="bt_Thugon" runat="server" CssClass="btx"
                    Text="Thu g&#7885;n" onclick="bt_Thugon_Click" Visible="false" />     
  
                  <table style="font-size:small; margin-left:50px">
                      <tr>
                          <td>
                             <asp:Label ID="Lb_tt1" runat="server"  Text=""></asp:Label>
                          </td>
                          <td>
                          </td>
                      </tr>
                      <tr>
                          <td>
                               <asp:Label ID="Lb_tt2" runat="server"  Text=""></asp:Label>
                          </td>
                          <td> 
                          <asp:Label ID="Lb_tt14" runat="server"  Visible="false" Text=""></asp:Label>
                          </td> 
                      </tr>
                      <tr>
                          <td>
                              <asp:Label ID="Lb_tt3" runat="server"   Text=""></asp:Label>
                          </td>
                          <td>
                               <asp:Label ID="Lb_tt15" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                        
                      </tr>

                        <tr>
                          <td>
                         <asp:Label ID="Lb_tt4" runat="server"  Text=""></asp:Label>
                          </td>
                          <td>
                                 <asp:Label ID="Lb_tt16" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                       
                      </tr>
                      <tr>
                          <td>
                          <asp:Label ID="Lb_tt5" runat="server"   Text=""></asp:Label>
                          </td>
                          <td>
                              <asp:Label ID="Lb_tt17" runat="server"  Visible="false" Text=""></asp:Label>
                              <br/>
                              <asp:Label ID="Lb_tt18" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                       
                      </tr>
                      <tr>
                          <td>
                         <asp:Label ID="Lb_tt6" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                             <b><asp:Label ID="Label1" runat="server"  Visible="false" Text="M&#7913;c L&#432;&#417;ng:"></asp:Label></b>
                          </td>
                         
                      </tr>
                      <tr>
                          <td>
                        <asp:Label ID="Lb_tt7" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                             <asp:Label ID="Lb_tt19" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                         
                      </tr>
                      <tr>
                          <td>
                          <asp:Label ID="Lb_tt8" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                              <asp:Label ID="Lb_tt20" runat="server"  Visible="false" Text=""></asp:Label>
                              <asp:Label ID="Lb_tt21" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          
                      </tr>
                      <tr>
                          <td>
                         <asp:Label ID="Lb_tt9" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                             
                             <asp:Label ID="Lb_tt22" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                      </tr>
                      <tr>
                          <td>
                            <asp:Label ID="Lb_tt10" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                              <asp:Label ID="Lb_tt23" runat="server"  Visible="false" Text=""></asp:Label>
                          </td> 
                      </tr>
                      <tr>
                          <td>
                           <asp:Label ID="Lb_tt11" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                             
                          </td>
                      
                      </tr>
                      <tr>
                          <td>
                          <asp:Label ID="Lb_tt12" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                              </td>
                      </tr>
                      <tr>
                          <td>
                             <asp:Label ID="Lb_tt13" runat="server"  Visible="false" Text=""></asp:Label>
                          </td>
                          <td>
                         </td>
                      </tr>
                  </table>
                  <br/>
</asp:Content>
